﻿using Microsoft.Practices.Unity;
using Sasa.QualityTools.CodeAnalysis.Core.VisualStudio;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Commands.Behaviors.CodeAnalysis.Metrics
{
    public class CreateSolutionMetricsCalculatorBehavior : CreateCodeMetricsCalculatorBehaviorBase
    {
        public CreateSolutionMetricsCalculatorBehavior(IUnityContainer container)
            : base(container)
        {
        }


        public override void Behave(CodeAnalysisCommandExecutionContext context)
        {
            var ide = Container.Resolve<IIde>();
            var solution = ide.Solution;

            foreach (var project in solution.GetBuildTargetProjects(true))
            {
                context.Progress.CodeAnalyzers.Add(BuildupCodeMetricsCalculator(project));
            }
        }
    }
}
